<template>
  <div>
    <el-menu router :default-active="activeMenuPath">
      <div v-for="(item, index) in filteredRoutes" :key="index" :index="index+''">
        <el-submenu v-for="(item2, index2) in item.children" :key="index2" :index="item2.path">
          <template slot="title"><i class="el-icon-menu"></i>{{ item2.name }}</template>
          <el-menu-item v-for="(item3, index3) in item2.children" :key="index3" :index="item3.path">
            <i class="el-icon-s-promotion"></i>{{ item3.name }}
          </el-menu-item>
        </el-submenu>
      </div>
    </el-menu>
  </div>
</template>

<script>

export default {
  name: 'AsidesView',
  data () {
    return {
      type: null
    }
  },
  created () {
    //this.type = sessionStorage.getItem('type')
    this.type = sessionStorage.getItem('type')
  },
  computed: {
    activeMenuPath () {
      return this.$route.path
    },
    filteredRoutes () {
      return this.$router.options.routes.filter(route => route.name === this.type)
    }
  }
}
</script>

<style scoped>

</style>
